package com.ucomm.talent.adapter;



import java.util.ArrayList;

import com.ucomm.talent.AppConfig;
import com.ucomm.talent.R;
import com.ucomm.talent.model.HotCompanyInfo;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class HotCompanyListAdapter extends BaseAdapter{
	
	private LayoutInflater mInflater;
	private ArrayList<HotCompanyInfo> mData;
	
	public HotCompanyListAdapter(Context context,ArrayList<HotCompanyInfo> mData) {
		this.mInflater = LayoutInflater.from(context);
		this.mData = mData;
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return mData.size();
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return mData.get(position);
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		ViewHolder holder = null;
	        if (convertView == null) {

	            holder=new ViewHolder();

	            convertView = mInflater.inflate(R.layout.hotcompany_list_item, null);
	            holder.company_name = (TextView) convertView.findViewById(R.id.company_name);
	            holder.certified_company = (TextView)convertView.findViewById(R.id.certified_company);
	            holder.approval = (TextView)convertView.findViewById(R.id.approval);
	            holder.company_id = (TextView) convertView.findViewById(R.id.company_id);
	            holder.company_address = (TextView) convertView.findViewById(R.id.company_address);

	            convertView.setTag(holder);

	        }else {
	            holder = (ViewHolder)convertView.getTag();
	        }
	        HotCompanyInfo info = mData.get(position);
//	        String company_name=null;
//	        String company_id = null;
//	        String company_address = null;
//	        if(AppConfig.jobMap.size() != 0 && AppConfig.cityMap.size() != 0 && AppConfig.comMap.size() != 0 && 
//	        		AppConfig.industryMap.size() != 0 && AppConfig.userMap.size() != 0){
//	        	company_name = 
//	        }
	        holder.company_name.setText(info.getCompanyName());
	        holder.company_id.setText(info.getCompanyId()+"");
	        holder.company_address.setText(info.getAddress());
//	        JobOfferInfo info = mData.get(position);
//	        holder.job_name.setText(info.getName());
//	        holder.work_category.setText(info.getClassification());
//	        String address = info.getProvinceId()+info.getCityId()+"";
//	        holder.work_location.setText(address);
//	        holder.work_treatment.setText(info.getSalary()+"");
//	        holder.work_enterprise.setText(info.getCompanyId()+"");


	        return convertView;
	}
	 final class ViewHolder{
	        public TextView company_name;
	        public TextView certified_company;
	        public TextView approval;
	        public TextView company_id;
	        public TextView company_address;
		}
	public ArrayList<HotCompanyInfo> getmData() {
		// TODO Auto-generated method stub
		return mData;
	}
	
}
